Use distinctive names for SPI pin macros to avoid collisions #71
+57
−27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The "ArduinoISP" example allows the user to define arbitrary pins for use as the signal pins on the programmer board. This is done via a set of macros.
Previously, very generic names were used for these macros. This resulted in a name collision. The core for the Renesas boards also defines macros of the same name:
https://github.com/arduino/ArduinoCore-renesas/blob/1.0.5/cores/arduino/variant.h#L48-L50
Despite what the names might lead us to believe, the values of these macros in the core do not match the Arduino pin numbers of the SPI bus. The result was that, with the default configuration of the sketch where the
USE_OLD_STYLE_WIRING
macro is not defined:arduino-examples/examples/11.ArduinoISP/ArduinoISP/ArduinoISP.ino
Line 81 in fdbfc5b
the sketch uses the values of the macros defined by the core as the SPI signal pins instead of the standard SPI signal pins as the user would expect when the sketch is running on an UNO R4 Minima, UNO R4 WiFi, or Portenta C33 board. This causes operations using the programmer to fail with an error like:
The name collision is avoided by adding a "namespace" prefix to the macro names.
Additional Context
Originally reported at https://forum.arduino.cc/t/can-i-use-the-r4-minima-as-an-icsp/1170056